#include <iostream>
#include <queue>
using namespace std;
#include "PriorityQueue.h"

int main()
{
	int a[] = { 1,4,2,5,6,3,2 };
	txp::priority_queue<int> pq(a, a + sizeof(a) / sizeof(int));

	while (!pq.empty())
	{
		cout << pq.top() << " ";
		pq.pop();
	}
	cout << endl;

	return 0;
}

int main3()
{
	txp::priority_queue<int> pq;
	pq.push(3);
	pq.push(1);
	pq.push(2);
	pq.push(4);

	while (!pq.empty())
	{
		cout << pq.top() << " ";
		pq.pop();
	}
	cout << endl;

	return 0;
}

class Solution {
public:
	int findKthLargest(vector<int>& nums, int k) {
		priority_queue<int> pq(nums.begin(), nums.end());

		while (--k)
		{
			pq.pop();
		}

		return pq.top();
	}
};

int main2()
{
	vector<int> nums = { 3,2,1,5,6,4 };
	cout << Solution().findKthLargest(nums, 2) << endl;

	return 0;
}

int main1()
{
	priority_queue<int, vector<int>,greater<int>> pq;
	pq.push(1);
	pq.push(3);
	pq.push(2);
	pq.push(8);
	pq.push(15);

	while (!pq.empty())
	{
		cout << pq.top() << endl;
		pq.pop();
	}

	return 0;
}